home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / FNTPAK32.ZIP / C.EXE / DEMO_MON.C < prev    next >
C/C++ Source or Header  |  1995-08-16  |  2KB  |  75 lines

  1. /*************************************************************************
  2.     Demo_Mon.C                  Copyright 1994, Rob W. Smetana
  3.  
  4.     Turn Screen Swapping ON if appropriate.
  5.  
  6.     Demonstrate how to detect monitor type.  We need EGA/VGA to change fonts.
  7.  
  8.     Requires:  Video.Obj, which contains function GetMonitor
  9.  
  10. **************************************************************************/
  11.  
  12. #include <font_pak.h>        /* for prototypes */
  13.  
  14.  
  15. int GetFontSize ();          /* local get-monitor function to detect EGA/VGA
  16.                                 and return size of default font (14/16)
  17.                                 -or- print error message if appropriate */
  18. void main (void)
  19.  
  20. {
  21.     int FSize;
  22.  
  23.     FSize = GetFontSize ();     /* FontSize returns 14, 16 or 0 (no EGA/VGA) */
  24.  
  25.     printf ("Default font height: 8 x %d \n",FSize);
  26.  
  27.  
  28. }   /* end main */
  29.  
  30. /*******************************************************************
  31.  Function:  GetFontSize
  32.  
  33.  Purpose:   Check for EGA/VGA and return 14 (EGA 8x14), 16 (VGA 8x16)
  34.             or 0 if we're not using an EGA/VGA
  35.             Print error message and end if no EGA/VGA
  36.             Return FontSize for use in other functions
  37.  
  38. GetMonitor returns an integer (0 - 8) indicating the type of monitor
  39.            in use.  If two monitors are being used, GetMonitor returns
  40.            the type of the primary monitor.
  41.  
  42.            0 = None (no monitor)    3 = EGA (or MultiSync)
  43.            4 = Color (CGA)          5 = Monochrome
  44.            7 = VGA Monochrome       8 = VGA Color (or MultiSync)
  45.  
  46. *******************************************************************/
  47.  
  48. int GetFontSize ()
  49.  
  50. {
  51.     int MonType;
  52.     MonType = GETMONITOR();
  53.  
  54.     switch (MonType)  {
  55.        case 0, 4, 5:        /* no monitor, Mono or CGA */
  56.         printf ("\nSorry.  An EGA or VGA monitor is required to run this demo. \n\n");
  57.          return (0);
  58.          break;
  59.        case 3:              /* EGA.  Set fontsize to 8x14 */
  60.         printf ("\nEGA (or compatible) monitor detected. \n\n");
  61.          return (14);
  62.          break;
  63.        case 7, 8:           /* VGA.  Set fontsize to 8x16 */
  64.         printf ("\nVGA (or compatible) monitor detected. \n\n");
  65.          return (16);
  66.          break;
  67.        default:
  68.         printf ("\nUnknown monitor type.  Sorry.  An EGA or VGA monitor is required to run this. \n\n");
  69.          return (0);
  70.          break;
  71.     }
  72.  
  73. }
  74.  
  75.